<template id="nav">
  <div id="wrapper">
    <!-- /.navbar-top-links -->
    <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
          <span class="sr-only">跳板机</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand">开源跳板机</a>
      </div>
      <div class="navbar-default sidebar" role="navigation">
        <div class="sidebar-nav navbar-collapse">
          <ul class="nav" id="side-menu">
            <li>
              <a href="#"><i class="fa fa-dashboard fa-fw"></i> 开源跳板机</a>
            </li>
            <li>
              <a href="#"><i class="fa fa-sitemap fa-fw"></i> 我的设备<span class="fa arrow"></span></a>
              <ul class="nav nav-second-level">
                <li>
                  <router-link to="/myHost">
                    我的设备列表
                  </router-link>
                </li>
              </ul>
              <!-- /.Nav-second-level -->
            </li>
            <li>
              <a href="#"><i class="fa fa-terminal fa-fw"></i> 设备管理<span class="fa arrow"></span></a>
              <ul class="nav nav-second-level">
                <li>
                  <router-link to="/hosts">
                    设备列表
                  </router-link>
                </li>
                <li>
                  <router-link to="/user">
                    用户管理
                  </router-link>
                </li>
              </ul>
              <!-- /.Nav-second-level -->
            </li>
          </ul>
        </div>
        <!-- /.sidebar-collapse -->
      </div>
      <div class="navbar-right">
        <ul class="nav navbar-top-links navbar-right">
          <li>
            <a href="#" @click="logout"><i class="fa fa-user fa-fw"></i> 退出</a>
          </li>
        </ul>
      </div>
      <!-- /.navbar-static-side -->
    </nav>
    <!-- Navigation -->
  </div>
</template>

<script>
  import api from '../api/user'
  import router from "../router";
  export default {
    name: "navigation",
    methods: {
      logout: function () {
          api.logout(res=>{
            if (res.status){
              router.push("login")
            }
          })
      }
    }
  }
</script>

<style scoped>

</style>
